package com.zf.shuashua.manager.track;

import com.umeng.analytics.MobclickAgent;
import com.vise.xsnow.http.callback.ACallback;
import com.zf.shuashua.ShuaApplication;
import com.zf.shuashua.api.HttpData;
import com.zf.shuashua.api.Store;
import com.zf.shuashua.bean.BaseData;

import java.util.HashMap;
import java.util.Map;

/**
 * 埋点
 */
public class TrackManager {

    private static TrackManager instance;

    private TrackManager() {

    }

    public static TrackManager getInstance() {
        if (null == instance) {
            synchronized (TrackManager.class) {
                if (null == instance) {
                    instance = new TrackManager();
                }
            }
        }
        return instance;
    }


    /**
     * @param pageId 页面id, 示例: 1001
     * @param action 埋点动作, 示例: Login_submit
     * @param note   文字描述, 示例: 登录按钮
     */
    public void reportAdvertAction(int pageId, String action, String note) {
        if (Store.getInstance().getNEW_OR_OLDE()) {
            MobclickAgent.onEvent(ShuaApplication.getContext(), action, "新用户");
        } else {
            MobclickAgent.onEvent(ShuaApplication.getContext(), action, "老用户");
        }

//        Map<String, Object> map = new HashMap<>();
//        if (Store.getInstance().getNEW_OR_OLDE()) {
//            map.put("IsNewUser", 0);
//        } else {
//            map.put("IsNewUser", 1);
//        }
//        MobclickAgent.onEventObject(ShuaApplication.getContext(), action, map);

    }

}
